package com.cx.mall.demo.dao.impl;

import com.cx.mall.demo.dao.IUserLoginLogDao;
import com.cx.mall.demo.entity.UserLoginLog;
import com.cx.mall.jdbc.JdbcUtils;

import java.sql.SQLException;

public class UserLoginLogDaoImpl {
    /*@Override
    public void insert(UserLoginLog entity) throws SQLException {
        String sql = "INSERT INTO `user_login_log` VALUES (?,?,?,?)";
        Object[] params = {
                entity.getId(),
                entity.getUserId(),
                entity.getLoginTime(),
                entity.getIp()
        };
        JdbcUtils.update(sql,params);
    }

    @Override
    public void updateById(UserLoginLog entity) throws SQLException {
        String sql = "UPDATE `user_login_log` SET user_id = ?,create_time = ?,ip = ? where id = ?";
        Object[] params = {
                entity.getUserId(),
                entity.getLoginTime(),
                entity.getIp(),
                entity.getId()
        };
        JdbcUtils.update(sql,params);
        System.out.println("更新成功");
    }

    @Override
    public void deleteById(Long id) throws SQLException {
        String sql = "DELETE FROM `user_login_log` WHERE id = ?";
        JdbcUtils.update(sql,id);
        System.out.println("删除成功");

    }

    @Override
    public UserLoginLog selectById(Long id) throws Exception {
        String sql = "SELECT * FROM `user_login_log` WHERE id = ?";
        return JdbcUtils.queryBean(sql,UserLoginLog.class,id);
    }*/
}
